package day04;


import java.util.Comparator;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;

public class PQDemo {
    public static void main(String[] args) {
        int[] a = {1, 3, 5, 7, 9, 2, 4, 6, 8, 0};
        Queue<Integer> queue = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });//FIFO
        for (int i = 0; i < 10; i++) {
            queue.offer(-1 * a[i]);
        }
        while (!queue.isEmpty()) {
            System.out.print(-1 * queue.peek() + " ");
            queue.poll();
        }
    }
}